// 接口方法
import reqeust from '@/utils/request'
import { getToken } from '@/utils/token'

export const getChannelListAPI = () => reqeust({
  url: '/v1_0/channels'
})
// 定义登录接口方法
export const loginAPI = ({ mobile, code }) => {
  return reqeust({
    url: '/v1_0/authorizations',
    method: 'POST',
    data: {
      mobile,
      code
    }
  })
}

// 获取用户的频道
export const getUserChannelListAPI = () => reqeust({
  url: '/v1_0/user/channels',
  headers: { Authorization: `Bearer ${getToken()}` }
})
// 获取用户数据
export const getArticleListAPI = ({ channel_id, timestamp }) => reqeust({
  url: '/v1_0/articles',
  method: 'GET',
  headers: { Authorization: `Bearer ${getToken()}` },
  params: {
    channel_id,
    timestamp
  }
})

// 不喜欢的文章id接口
export const dislikeArticleAPI = (artId) => reqeust({
  url: '/v1_0/article/dislikes',
  method: 'POST',
  headers: { Authorization: `Bearer ${getToken()}` },
  data: {
    target: artId
  }
})
// 举报文章
export const jubaoArticleAPI = ({ artId, type }) => reqeust({
  url: '/v1_0/article/dislikes',
  method: 'POST',
  headers: { Authorization: `Bearer ${getToken()}` },
  data: {
    target: artId,
    type: type,
    remark: '其他问题'

  }
})
